<?php

namespace App\Listeners;

use App\Events\StoreOrderStatusEvent;
use App\Models\StoreOrderStatus;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;

class StatusListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  \App\Events\StoreOrderStatusEvent  $event
     * @return void
     */
    public function handle(StoreOrderStatusEvent $event)
    {
        try {
            $res= StoreOrderStatus::orderStatus("$event->id","$event->change_type","$event->change_message");
        }catch (\Exception $exception){
            return ['code'=>'20001','msg'=>$exception->getMessage(),'data'=>[]];
        }

    }
}
